home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / cnet / EditLogin.lha / EditLogin / EditLogin.rexx < prev    next >
OS/2 REXX Batch file  |  1995-04-25  |  3KB  |  124 lines

  1. /* $VER: EditLogin.rexx 1.0 (4/25/95 by Spike Dethman)
  2. */
  3. /* allow users to edit their own individual sys.welcome series */
  4.  
  5. options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
  6.  
  7. changewhere 'Editing login'
  8. getuser 39 ; uucp=result ; userwelcome='Mail:users/'uucp'/sys.welcome'
  9. getuser 27 ; width=result ; getuser 28 ; term=result
  10. editwelcome='Pfiles:EditLogin.welcome'
  11. defwelcome='systext:tt'term'.welcome.default'
  12. if ~exists(defwelcome) then defwelcome='systext:sys.welcome.default'
  13.  
  14. Start:
  15. if ~exists(editwelcome) then do ;
  16.     transmit editwelcome' not found- Please inform Sysop.' ;
  17.     exit ;
  18. end
  19.  
  20. LoadLogin:
  21.     totoptions=0
  22.     call open('i',editwelcome,'r')
  23.     do while ~eof('i') ;
  24.         i=totoptions+1 ;
  25.         opttext.i=readln('i') ; if eof('i') then iterate ;
  26.         optdesc.i=readln('i') ; if eof('i') then iterate ;
  27.         optcmd.i=readln('i') ; if eof('i') then iterate ;
  28.         totoptions=totoptions+1 ;
  29.     end
  30.     call close('i')
  31.  
  32.     do i=1 to totoptions ;
  33.         optflag.i=0 ;
  34.     end i
  35.  
  36.     file=userwelcome ; call LoadUser
  37.  
  38. Menu:
  39.     transmit 'n1Here are your current login options:n1'
  40.     otxt='Test This Login' ; onum=1 ; ostat=-1 ; call ListOpt
  41.     otxt='Reset to system defaults' ; onum=2 ; ostat=-1 ; call ListOpt
  42.     do i=1 to totoptions ;
  43.         otxt=opttext.i ; onum=i+2 ; ostat=optflag.i ; call ListOpt ;
  44.     end i
  45.  
  46.     if totoptions%2~=totoptions/2 then sendstring 'n1'
  47.  
  48.     sendstring 'n1Enter the # of the item to change, or press ENTER to continue.n1:i64 3}'
  49.     getuser 70 ; choice=result
  50.  
  51.     if choice='' then signal SaveExit 
  52.  
  53.     if choice<1 | choice>totoptions+2 then signal Menu
  54.  
  55.     if choice=1 then do ;
  56.          call LoginTest ; signal MENU ;
  57.     end
  58.  
  59.     if choice=2 then do ;
  60.         file=defwelcome ; call LoadUser ; signal Menu ;
  61.     end
  62.  
  63.     i=choice-2
  64.     transmit 'n1'optdesc.i
  65.     sendstring 'n1Do you want to enable the "'opttext.i'" option [Yes] ?1}'
  66.     getuser 70 ; optflag.i=result
  67.  
  68.     signal Menu
  69.  
  70. SaveExit:
  71.     call open('o',userwelcome,'w')
  72.     do i=1 to totoptions ;
  73.         if optflag.i=1 then call writeln('o',optcmd.i) ;
  74.     end i
  75.     call close('o')
  76.  
  77.     exit
  78.  
  79.  
  80.  
  81.  
  82. LoginTest:
  83.     transmit 'Testing Login...n1'
  84.     do i=1 to totoptions ;
  85.         if optflag.i=1 then do ;
  86.             transmit optcmd.i ;
  87.         end ;
  88.     end i
  89.  
  90.     return
  91.  
  92. LoadUser:
  93.     if ~exists(file) then file=defwelcome
  94.     call open(f1,file,'r')
  95.     do while ~eof(f1) ;
  96.         cmdline=readln(f1) ; if eof(f1) then iterate ;
  97.         do i=1 to totoptions ;
  98.             if cmdline=optcmd.i then optflag.i=1 ;
  99.         end i ;
  100.     end
  101.     call close(f1)
  102.  
  103.     return
  104.  
  105. ListOpt:
  106.     sendstring right(' 'onum') ',4)left(otxt||copies(' ',28),28)
  107.     if ostat>-1 then do ;
  108.         if ostat=0 then otxt=': No  ' ;
  109.         else otxt=': Yes ' ;
  110.         sendstring otxt ;
  111.     end
  112.     else sendstring '      '
  113.  
  114.     if width<80 | onum%2=onum/2 then sendstring 'n1'
  115.  
  116.     return
  117.  
  118. SYNTAX:
  119. ERROR:
  120. IOERR:
  121. transmit errortext(RC)" error in l "sigl"n1>>"sourceline(sigl)"<< in EditLogin.rexx"
  122. bufferflush
  123. exit 10
  124.